<?php

class Application_Form_RmaAdditems extends Zend_Form
{

	public function init()
	{
		$itemValidator = new Zend_Validate_Db_RecordExists(
				array(
						'table' => 'bis.tbl_inventoryItem',
						'field' => 'inventoryItem'
				)
		);
		
		
		$this->setDecorators(array(
		
				array('ViewScript', array(
						// the view template script
						'viewScript' => 'forms/rmaadditems.phtml'))
		));
		
		$this->setMethod('post');
		
		$rma_id = new Zend_Form_Element_Hidden('rma_id');
		
		$inventoryItem = new Zend_Form_Element_Text('inventoryItem');
		$inventoryItem->setLabel('InventoryItem');
		$inventoryItem->setOptions(array('size' => '10'));
		$inventoryItem->setRequired(true);
		$inventoryItem->addValidator($itemValidator);
		
		$inventoryItemDesc = new Zend_Form_Element_Text('inventoryItemDesc');
		$inventoryItemDesc->setLabel('InventoryItem Desc');
		$inventoryItemDesc->setOptions(array('readonly' => 'readonly', 'size' => '50'));
		$inventoryItemDesc->setIgnore(true);
		
		$rmaQuantity = new Zend_Form_Element_Text('rmaQuantity');
		$rmaQuantity->setLabel('Return quantity');
		$rmaQuantity->setOptions(array('size' => '5'));
		$rmaQuantity->setRequired(true);
				
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setLabel('add item and continue adding item');
		
		$this->addElements(array($rma_id, $inventoryItem, $inventoryItemDesc, $rmaQuantity, $submit));
		
		//Enable Zend form inputboxes and error output
		$this->setElementDecorators(array('ViewHelper', 'Errors'));

		
	}


}

